#pragma once
#include <arpa/inet.h>
#include <sys/socket.h>
#include <unistd.h>
#include <iostream>

namespace sockets
{
	typedef struct sockaddr SA;
	int Socket(sa_family_t family)
	{
		int sockfd = socket(family, SOCK_STREAM, IPPROTO_TCP);
		if (sockfd < 0) 
		{
			std::cout << "sockets::createsocket failed!!!" << std::endl;
		}
		return sockfd;
	}
	//关闭socket描述符
	void Close(int sockfd)
	{
		if (close(sockfd) < 0)
		{
			std::cout << "close filed!!!!" << std::endl;
		}
	}
}